
package PDFd.ClientLibrary;

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.UUID;

import org.apache.http.util.ByteArrayBuffer;

import android.util.Log;
/**
* <p>Title: DummyRenderEngine</p>
* <p>Description: A testing engine that allows you to work
* independently from the server </p>
* @author Matt, Tom, Andrew, Kong
* @email matt.mckay@my.uwrf.edu,tom.florin@my.uwrf.edu,
* andrew.kathan@my.uwrf.edu,kong.xiong-1@my.uwrf.edu
* @date December 1st,2011*/
public class DummyRenderEngine implements IRenderEngine {
	public String addPDF(byte[] f) {
		return UUID.randomUUID().toString();
	}
/**
 * This method gets a PNG file from the URL link
 * @param uuid
 * @return baf.toByteArray()
 */
	public byte[] getAsPNG(String uuid, int duration) {
		ByteArrayBuffer baf = new ByteArrayBuffer(50);;
		try {
			URL url = new URL("http://184.72.217.18/facebook.png");
			URLConnection ucon = url.openConnection();
			InputStream is = ucon.getInputStream();
			BufferedInputStream bis = new BufferedInputStream(is);
			int current = 0;
			while ((current = bis.read()) != -1) {
				baf.append((byte) current);
			}
		} catch (Exception e) {
			Log.i("DummyRenderEngine",e.toString());
		}
		return baf.toByteArray();
	}
	
	/**
	 * This method takes the unique user ID, and the PNG and
	 * gets it as a PDF
	 * @param uuid
	 * @param overlayPNG
	 * @return null
	 */
	public byte[] getAsPDF(String uuid, byte[] overlayPNG) {
		return null;
	}

}
